package com.ych.modules.api.unAuthorInfc.agreement.controller;

import com.ych.modules.base.dbEntity.TSysAgreementEntity;
import com.ych.modules.common.service.AgreementService;
import com.ych.utils.serviceReturn.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Author: Usopp.tsui
 * Date: 2021/1/4
 * Time: 16:27
 * Description:
 */
@RestController("apiAgreementController")
@RequestMapping("/api/unAuth/agreement")
@Api(tags = {"API——协议相关"}, description = "API——协议相关", position = 2)
public class AgreementController {
    @Autowired
    private AgreementService agreementService;

    @PostMapping("/getAgreement")
    @ApiOperation(value = "协议查询", notes = "协议查询")
    public R<TSysAgreementEntity> getAgreement(@RequestBody String agreementId) {
        try {
            TSysAgreementEntity entity = agreementService.getAgreement(agreementId);
            return new R(0, "成功", entity);
        } catch (Exception e) {
            return new R(1, e.getMessage(), null);
        }
    }
}
